$(function() {

    var ismedia = 'img';
    var str_cont = '';
    var str_folder = 'img';


    tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
        theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect",
        theme_advanced_buttons2 : "outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,code",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : false,
        content_css : base_url+"assets/js/_plugins/tinymce/themes/advanced/skins/default/custom_content.css"
    });

    $('input[name=uptitle]').keyup(function() {

        $('.preview .art_intro .text h2').text($(this).val());

        if($('.preview .art_intro .text h2').html()=='')$('.preview .art_intro .text h2').html('NAD NASLOV');

    });

    $('input[name=title]').keyup(function() {

        $('.preview .art_intro .text h1').html($(this).val());

        if($('.preview .art_intro .text h1').html()=='')$('.preview .art_intro .text h1').html('NASLOV');

    });

    $('input[name=intro]').keyup(function() {

        $('.preview .art_intro .text p').html($(this).val());

        if($('.preview .art_intro .text p').html()=='')$('.preview .art_intro .text p').html('Uvod');

    });

    $('#texthndlr').live('click', function(){
        $('.preview .art_cont .column').html(tinyMCE.get('text').getContent());   
    })


    $('#form_submit').live('click', function(){

        $("#newartform").trigger('submit');

    })    

});

                            